<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>保险公司 管理</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <div id="ligergrid1_pol" class="sq-grid"></div>
</div>
<script>
    var polGrid = null;
    $(function () {
        var insCompId = "${insCompId}";
        var chnCd = "${chnCd}";

        polGrid = $("#ligergrid1_pol").ligerGrid({
            url: '<%=path%>/insurance/insCompChnPol/initList.do?insCompId=' + insCompId,
            method: 'get',
            columns: [
                {display: '支付表编号', name: 'paySchNo', width: 170, align: 'left'},
                {display: '保险产品类型', name: 'prdTypCdNm', width: 100, align: 'center'},
                {display: '使用控制', name: 'insTypCdNm', width: 80, align: 'center'},
                {display: '返利性质', name: 'rebNatCdNm', width: 80, align: 'center'},
                {display: '返利金额', name: 'rebAmt', width: 80, align: 'right',
                    render:function(rowdata,index,value){
                        return '&yen;'+FormatMoney(rowdata.rebAmt/100);
                    }
                },
                {display: '返利时间', name: 'rebDt', width: 90, render: renderDate, align: 'center'},
                {display: '流程编号', name: 'prInstNo', minWidth: 100, align: 'center',
                    render: function (rowdata, rowindex, value, column) {
                        var h = '';
                        if(value){
                            h+='<a href="javascript:commShowFlow(';
                            h+="'"+rowdata.prInstId+"',";
                            h+="'"+rowdata.audStsCd+"',";
                            h+="'"+rowdata.businessKey+"'";
                            h+=')">'+value+'</a>'
                        }
                        return h;
                    },
                },
                {display: '审核状态', name: 'audStsCdNm', width: 80, align: 'center'},
                {display: '备注', name: 'chnPolRem', minWidth: 100, align: 'left',isEllipsis: false},
            ],
            usePager: false,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: 'auto',
            heightDiff: -2,
            isScroll: false,
            rownumbers: true,
            allowUnSelectRow: true,
            alternatingRow: false
        });

    });

    function getDelColumn(){}

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }

    //显示流程
    function commShowFlow(_pInstId,_audStsCd,prInstId){
        if(StringUtils.isEmpty(_pInstId)){
            UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
            return;
        }
        var _formUrl = "/insurance/insCompInfo/toProcessPage.do?flag=2@@prInstId=";
        var params = "?pInsId="+_pInstId+"&status="+_audStsCd+"&businessKey="+prInstId+"&formUrl="+_formUrl;
        var timestamp=new Date().getTime();
        Add_navTab('tab_cst_invoice_flow_'+timestamp,'查看流程',"<%=path%>/flow/flow/toFlowShowPageFowBus.do"+params);
    }

</script>
</body>
</html>